package com.jk.service;

import com.jk.dao.PayUserIntegralDao;
import com.jk.pojo.PayUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;


/**
 * Created by Administrator on 2017/12/20 0020.
 */
@Service("payUserIntegralServiceImpl")
public class PayUserIntegralServiceImpl implements PayUserIntegralService {
    @Autowired
    private PayUserIntegralDao payUserIntegralDao;

    /**
     * 根据用户id查询用户会员积分接口实现类
     * cjq
     *
     * @param userid
     * @return
     */
    @Override
    public PayUser queryPayUserIntegralCount(String userid) {
        //查询用户会员积分返回到controller层
        return payUserIntegralDao.queryPayUserIntegralCount(userid);
    }

    //定时器定时清空用户的会员积分
    @Scheduled(cron = "0 0 0 1 1 ?")
    public void time() {
        //调用查询用户积分的方法来进行定时清空用户积分的操作
        payUserIntegralDao.editPayUserIntegralCount();
    }

    //使用定时器为会员用户送上生日祝福
    public PayUser userBirthday(String userid){
        return payUserIntegralDao.queryPayUserIdentityCard(userid);
    }
}
